<?php

$haystack = "abcdefghijklmnoprstuv0123456789";
//echo $alfabet[2];

while ($needle != 'a')
{
  $rnd = rand(0, strlen($haystack)-1);
  $needle = $haystack[$rnd];
  echo $needle;
  $counter++;
}
echo "<br>$counter";

?>